PRGE Outcome

Column

BRIEF Client Responses

BRIEF Parent Responses

CLASS 1

CLASS 2

PCSS

Column

Client Demographics

Client Demographics
Sex Age Prior Concussions History of Depression or Anxiety
Female 16 3 No

PRGE Repeated

Column

Status Tracking

Perceived Motivation

Perceived Strategy Helpfulness

Client Receipt of Psychoeducation

FALO Outcome

Column

BRIEF Client Responses

BRIEF Parent Responses

CLASS 1

CLASS 2

PCSS

HIT

Column

Client Demographics

Client Demographics
Sex Age Prior Concussions History of Depression or Anxiety
Male 18 4 No

FALO Repeated

Column

Status Tracking 1

Phone Strategy Use

Perceived Effectiveness

Status Tracking 2

Planner Use

Planner Helpfulness

Time Block Use

Planner Helpfulness

DRKAT Outcome

Column

BRIEF

CLASS 1

CLASS post-treatment scores not included as the client was not actively enrolled in school for the majority of the duration of treatment.

CLASS 2

CLASS post-treatment scores not included as the client was not actively enrolled in school for the majority of the duration of treatment.

PCSS

HIT

Column

Client Demographics

Client Demographics
Sex Age Prior Concussions History of Depression or Anxiety
Female 19 4 No

DRKAT Repeated

Column

Status Tracking

Perceived Effort

Perceived Motivation

Planner Use

Perceived Helpfulness

---
title: "Pilot Data 2020"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    social: menu
    source_code: embed
    vertical_layout: scroll
    theme: spacelab
---

```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse)
library(rio)
library(here)
library(colorblindr)
library(gghighlight)
library(forcats)
library(ggrepel)
library(gt)
library(knitr)
library(kableExtra)
library(reactable)
library(plotly)

opts_chunk$set(echo = FALSE,
               fig.width = 5,
               fig.height = 6)

theme_set(theme_minimal(base_size = 8))

outcome <- import(here("data", "client_data_outcome.sav"),
               setclass = "tbl_df") %>% 
  characterize() %>% 
  janitor::clean_names() 

rm_prge <- import(here("data", "repeated_measures_prge.sav"),
               setclass = "tbl_df") %>% 
  characterize() %>% 
  janitor::clean_names() 

head(outcome)
head(rm_prge)

prge_brief_self <- import(here("data", "prge_brief_self.xlsx"),
                      setclass = "tbl_df")

prge_brief_parent <- import(here("data", "prge_brief_parent.xlsx"),
                      setclass = "tbl_df")

prge_class_worse <- import(here("data", "prge_class.xlsx"),
                      setclass = "tbl_df")

prge_class_stress <- import(here("data", "prge_class_stress.xlsx"),
                       setclass = "tbl_df")

prge_pcss <- import(here("data", "pcss_prge.xlsx"),
               setclass = "tbl_df")

prge_education <- import(here("data", "prge_education.xlsx"),
               setclass = "tbl_df")

falo_brief_self <- import(here("data", "falo_brief_self.xlsx"),
                      setclass = "tbl_df")

falo_brief_parent <- import(here("data", "falo_brief_parent.xlsx"),
                      setclass = "tbl_df")

falo_class_worse <- import(here("data", "falo_class.xlsx"),
                      setclass = "tbl_df")

falo_class_stress <- import(here("data", "falo_class_stress.xlsx"),
                       setclass = "tbl_df")

falo_pcss <- import(here("data", "pcss_falo.xlsx"),
               setclass = "tbl_df")

drkat_brief_self <- import(here("data", "drkat_brief_self.xlsx"),
                      setclass = "tbl_df")

drkat_class_worse <- import(here("data", "drkat_class.xlsx"),
                      setclass = "tbl_df")

drkat_class_stress <- import(here("data", "drkat_class_stress.xlsx"),
                       setclass = "tbl_df")

drkat_pcss <- import(here("data", "pcss_drkat.xlsx"),
               setclass = "tbl_df")

rm_drkat <- import(here("data", "drkat_rm.xlsx"),
                   setclass = "tbl_df") %>% 
  janitor::clean_names()

head(rm_drkat)

brief_data <- import(here("data", "brief_pilot_data.xlsx"),
                     setclass = "tbl_df") %>% 
  janitor::clean_names()

head(brief_data)

falo_rm <- import(here("data", "falo_rm.xlsx"),
                  setclass = "tbl_df") %>% 
  janitor::clean_names()
```

# PRGE Outcome

Column {.tabset data-width=650}
-----------------------------------------------------------------------

```{r outcome measures data organization, include=FALSE}
head(outcome)


class <- outcome %>% 
  filter(client == "PRGE") %>% 
  select(client, class_total_pre, class_total_post) %>% 
  rename("Pre Score" = class_total_pre,
         "Post Score" = class_total_post)

class_tidy <- class %>% 
   pivot_longer(
    cols = c(2:3),
    names_to = "measure",
    values_to = "score"
  )


symptoms <- outcome %>% 
  filter(client == "PRGE") %>% 
  select(1, c(6:13)) %>% 
  rename("Feeling Slow Pre" = pcss_pre_feeling_slow,
         "Feeling Slow Post" = pcss_post_feeling_slow,
         "Feeling Foggy Pre" = pcss_pre_feeling_foggy,
         "Feeling Foggy Post" = pcss_post_feeling_foggy,
         "Difficulty Concentrating Pre" = pcss_pre_difficulty_concentrating,
         "Difficulty Concentrating Post" = pcss_post_difficulty_concentrating, 
         "Difficulty Remembering Pre" = pcss_pre_difficulty_remembering,
         "Difficulty Remembering Post" = pcss_post_difficulty_remembering) %>% 
  pivot_longer(
    cols = c(2:9),
    names_to = "measure",
    values_to = "score"
  )

hit <- outcome %>% 
  filter(client == "PRGE") %>% 
  select(client, hit_pre, hit_post) %>% 
  rename("Pre Score" = hit_pre,
         "Post Score" = hit_post) %>% 
   pivot_longer(
    cols = c(2:3),
    names_to = "measure",
    values_to = "score"
  )
```

```{r outcome plots, include=FALSE}
#geom_rect(aes(xmin = -Inf, xmax = Inf, ymin = 65, ymax = 100),
            #fill = "lightgreen") + #insert before geom_col 

class_positions <- c("Pre Score", "Post Score")

pcss_positions <- c("Difficulty Remembering Post",
                    "Difficulty Remembering Pre",
                    "Difficulty Concentrating Post",
                     "Difficulty Concentrating Pre",
                     "Feeling Foggy Post",
                    "Feeling Foggy Pre",
                    "Feeling Slow Post",
                    "Feeling Slow Pre")

hit_positions <- c("Pre Score", "Post Score")


p2 <- ggplot(class_tidy, aes(measure, score)) +
  geom_col(fill = "blue", 
           alpha = 0.7) +
  scale_x_discrete(limits = class_positions) +
  scale_y_continuous(limits = c(0, 60),
                     breaks = c(10, 20, 30, 40, 50, 60)) +
  geom_text(aes(measure, score, label = score),
            nudge_y = -3,
            color = "white") +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "",
       y = "Score",
       title = "CLASS Scores") 
 p2


p3 <- ggplot(symptoms, aes(measure, score)) +
  geom_hline(yintercept = 30, 
             linetype = "dashed",
             size = 1) +
  geom_col(fill = "blue", 
           alpha = 0.7) +
  scale_x_discrete(limits = pcss_positions) +
  scale_y_continuous(limits = c(0, 6),
                     breaks = c(0, 1, 2, 3, 4, 5, 6)) + 
  coord_flip() +
  geom_text(aes(measure, score, label = score),
            nudge_y = -0.5,
            color = "white") +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10)) +
  labs(x = "",
       y = "Score",
       title = "PCSS Results",
       subtitle = "Cognitive Symptoms",
       caption = "0 = No Symptoms\n 3 = Moderate Symptoms\n 6 = Severe Symptoms") 

p3

p3a <- ggplot(hit, aes(measure, score)) +
  geom_hline(yintercept = 50, 
             linetype = "dashed",
             size = 1) +
  geom_col(fill = "blue", 
           alpha = 0.7) +
  scale_x_discrete(limits = hit_positions) +
  scale_y_continuous(limits = c(0, 60),
                     breaks = c(10, 20, 30, 40, 50, 60)) + 
  geom_text(aes(measure, score, label = score),
            nudge_y = -3,
            color = "white") +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10)) +
  labs(x = "",
       y = "Score",
       title = "HIT Results",
       caption = "Scores of 50 or Greater Suggest Headaches Impact Daily Functioning") 

p3a

head(prge_class_worse)
head(prge_class_stress)

prge_class_worse_tidy <- prge_class_worse %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

class_1 <- c("Easily bothered by lights/screens or noise",
             "Tiring easily during homework",
             "Tiring easily during the school day",
             "Headaches interfering with homework",
             "Headaches interfering with classwork",
             "Easily distracted during homework",
             "Easily distracted during classwork",
             "Trouble reading",
             "Trouble remembering what was studied",
             "Difficulty studying for tests or quizzes",
             "Homework taking longer",
             "In class, work taking longer",
             "Difficulty understanding new material",
             "Difficulty taking notes")

class_1_resp <- c("A lot worse",
                  "Somewhat worse",
                  "A little worse",
                  "Not worse")

prge_class_worse_tidy$Assessment <- factor(prge_class_worse_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

prge_class_worse_plot <- ggplot(prge_class_worse_tidy, aes(`Question`, `Response`)) +
  geom_line(aes(group = `Question`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = class_1) +
  scale_y_discrete(limits = class_1_resp) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10, angle = 90),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "CLASS Responses",
       subtitle = "Questions 1-14")

prge_class_worse_plot

head(prge_class_stress)

prge_class_stress_tidy <- prge_class_stress %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

class_2 <- c("Stressed out about your grades dropping",
             "More stressed out/overwhelmed with the schoolwork piling up",
             "Not having enough support at home from parents/siblings",
             "Not having enough support from teachers",
             "Not being allowed to play sports/recreation",
             "Missing time with friends and/or social activities")

class_2_resp <- c("Very stressful",
                  "Moderately stressful",
                  "A little stressful",
                  "Not stressful")

prge_class_stress_tidy$Assessment <- factor(prge_class_stress_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

prge_class_stress_plot <- ggplot(prge_class_stress_tidy, aes(`Question`, `Response`)) +
  geom_line(aes(group = `Question`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = class_2) +
  scale_y_discrete(limits = class_2_resp) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10, angle = 90),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "CLASS Responses",
       subtitle = "Questions 15-20")

prge_class_stress_plot

head(prge_pcss)
prge_pcss_table <- prge_pcss %>% 
  reactable(
    columns = list(
      `Pre Test` = colDef(name = "Pre-Test"),
      `Post Test` = colDef(name = "Post-Test")),
    pagination = FALSE,
    striped = TRUE,
    outlined = TRUE,
    compact = TRUE,
    highlight = TRUE,
    bordered = TRUE,
    searchable = TRUE,
    height = 600,
    width = 500)
```

```{r prge brief update, include=FALSE}
head(prge_brief_parent)
head(prge_brief_self)

prge_brief_self_tidy <- prge_brief_self %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

head(prge_brief_self_tidy)

brief_scales <- c("Global Executive Composite",
                  "Cognitive Regulation Index",
                  "Organization Scale",
                  "Task Completion Scale",
                  "Plan/Organize Scale",
                  "Working Memory Scale",
                  "Initiate Scale",
                  "Emotional Regulation Index",
                  "Emotional Control Scale",
                  "Shift Scale",
                  "Behavior Regulation Index",
                  "Self-Monitor Scale",
                  "Inhibit Scale")

prge_brief_self_tidy$Assessment <- factor(prge_brief_self_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

prge_brief_self_plot <- ggplot(prge_brief_self_tidy, aes(`Scale/Index`, `Response`)) +
  geom_line(aes(group = `Scale/Index`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = brief_scales) +
  scale_y_continuous(limits = c(30, 90),
                     breaks = c(30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90)) +
  geom_text_repel(aes(label = `Response`)) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "BRIEF-2 Self-Report",
    subtitle = "Scores Greater than 65 are Considered Clinically Significant")

prge_brief_self_plot


prge_brief_parent_tidy <- prge_brief_parent %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

prge_brief_parent_tidy$Assessment <- factor(prge_brief_parent_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

prge_brief_parent_plot <- ggplot(prge_brief_parent_tidy, aes(`Scale/Index`, `Response`)) +
  geom_line(aes(group = `Scale/Index`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = brief_scales) +
  scale_y_continuous(limits = c(30, 90),
                     breaks = c(30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90)) +
  geom_text_repel(aes(label = `Response`)) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "BRIEF-2 Parent-Report",
    subtitle = "Scores Greater than 65 are Considered Clinically Significant")

prge_brief_parent_plot
```

### BRIEF Client Responses
```{r prge brief, include=TRUE, fig.width=8}
prge_brief_self_plot
```

### BRIEF Parent Responses
```{r prge brief parent, include=TRUE, fig.width=8}
prge_brief_parent_plot
```

### CLASS 1
```{r prge class 1, include=TRUE, fig.width=8}
prge_class_worse_plot
```

### CLASS 2
```{r prge class 2, include=TRUE, fig.width=8}
prge_class_stress_plot
```


### PCSS

```{r prge pcss, include=TRUE}
prge_pcss_table
```


Column {data-width=350}
-----------------------------------------------------------------------

### Client Demographics

```{r, include=FALSE}
head(outcome)

demo_prge <- outcome %>% 
  filter(client == "PRGE") %>% 
  select(2:5)
  
head(demo_prge)

prge_table <- demo_prge %>% 
  gt() %>% 
  cols_label(sex = "Sex",
             age = "Age",
             prev_mtbi = "Prior Concussions",
             hx_depression = "History of Depression or Anxiety") %>% 
  cols_align(align = "center", columns = vars(sex, age, prev_mtbi, hx_depression)) %>% 
  tab_header(title = "Client Demographics")
  
prge_table
```

```{r prge table, include=TRUE}
prge_table
```

# PRGE Repeated 

Column {.tabset data-width=650}
-----------------------------------------------------------------------

### Status Tracking

```{r repeated measures data cleaning, include=FALSE}

head(rm_prge)

track <- rm_prge %>% 
  select(session, status)

p4 <- ggplot(track, aes(session, status)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 6),
                     breaks = c(1, 2, 3, 4, 5, 6)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Number of Times Required to Reread Content",
       title = "Status Tracking Goal") 

p4


effort_data <- rm_prge %>% 
  select(session, effort)

p5 <- ggplot(effort_data, aes(session, effort)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 5),
                     breaks = c(1, 2, 3, 4, 5)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Perceived Level of Motivation",
       title = "Perceived Motivation While Reading",
       caption = "1 = No Motivation\n 2 = A little Motivation\n 3 = Somewhat Motivated\n 4 = Quite Motivated\n 5 = Extremely Motivated") 

p5

helpfulness <- rm_prge %>% 
  select(session, help)

p6 <- ggplot(helpfulness, aes(session, help)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 5),
                     breaks = c(1, 2, 3, 4, 5)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Perceived Helpfulness",
       title = "Perceived Helpfulness of Reading Strategies",
       caption = "1 = Not Helpful at All\n 2 = Not Helpful\n 3 = Somewhat Helpful\n 4 = Helpful\n 5 = Very Helpful") 

p6

head(prge_education)

pg_ed <- prge_education %>% 
  pivot_longer(
    cols = c(2:4),
    names_to = "education",
    values_to = "score"
  )

head(pg_ed)

p7 <- ggplot(pg_ed, aes(session, score)) +
  geom_point(aes(shape = education), size = 2) +
  geom_line() +
  scale_shape_manual(name = "Psychoeducation Topic",
                     labels = c("Assignment completion",
                              "Strategy use following concussion",
                              "Types of thinking"),
                     values = c(17, 16, 15)) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 5),
                     breaks = c(1, 2, 3, 4, 5)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Level of Understanding",
       title = "Client Understanding of\n Delivered Psychoeducation",
       caption = "5 = Client demonstrated understanding with independent teach back\n 4 = Client demonstrated understanding with minimum verbal prompting\n 3 = Client demonstrated understanding with moderate verbal prompting\n 2 = Client demonstrated understanding with maximum verbal prompting\n 1 = Client stated they did not understand nature of psychoeducation") 

p7
```


```{r status, include=TRUE}
p4
```

### Perceived Motivation 

```{r effort, include=TRUE, fig.align="left"}
p5
```

### Perceived Strategy Helpfulness 

```{r helpfulness, include=TRUE, fig.align="left"}
p6
```

### Client Receipt of Psychoeducation 

```{r prge psychoeducation, include=TRUE, fig.align="left", fig.width=10}
p7
```

# FALO Outcome

Column {.tabset data-width=650}
-----------------------------------------------------------------------

```{r falo measures data organization, include=FALSE}
head(outcome)

falo_hit <- outcome %>% 
  filter(client == "FALO")


head(falo_class_worse)
head(falo_class_stress)

falo_class_worse_tidy <- falo_class_worse %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

class_1 <- c("Easily bothered by lights/screens or noise",
             "Tiring easily during homework",
             "Tiring easily during the school day",
             "Headaches interfering with homework",
             "Headaches interfering with classwork",
             "Easily distracted during homework",
             "Easily distracted during classwork",
             "Trouble reading",
             "Trouble remembering what was studied",
             "Difficulty studying for tests or quizzes",
             "Homework taking longer",
             "In class, work taking longer",
             "Difficulty understanding new material",
             "Difficulty taking notes")

class_1_resp <- c("A lot worse",
                  "Somewhat worse",
                  "A little worse",
                  "Not worse")

falo_class_worse_tidy$Assessment <- factor(falo_class_worse_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

falo_class_worse_plot <- ggplot(falo_class_worse_tidy, aes(`Question`, `Response`)) +
  geom_line(aes(group = `Question`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = class_1) +
  scale_y_discrete(limits = class_1_resp) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10, angle = 90),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "CLASS Responses",
       subtitle = "Questions 1-14")

falo_class_worse_plot

head(falo_class_stress)

falo_class_stress_tidy <- falo_class_stress %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

class_2 <- c("Stressed out about your grades dropping",
             "More stressed out/overwhelmed with the schoolwork piling up",
             "Not having enough support at home from parents/siblings",
             "Not having enough support from teachers",
             "Not being allowed to play sports/recreation",
             "Missing time with friends and/or social activities")

class_2_resp <- c("Very stressful",
                  "Moderately stressful",
                  "A little stressful",
                  "Not stressful")

falo_class_stress_tidy$Assessment <- factor(falo_class_stress_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

falo_class_stress_plot <- ggplot(falo_class_stress_tidy, aes(`Question`, `Response`)) +
  geom_line(aes(group = `Question`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = class_2) +
  scale_y_discrete(limits = class_2_resp) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10, angle = 90),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "CLASS Responses",
       subtitle = "Questions 15-20")

falo_class_stress_plot

head(falo_pcss)
falo_pcss_table <- falo_pcss %>% 
  reactable(
    columns = list(
      `Pre Test` = colDef(name = "Pre-Test"),
      `Post Test` = colDef(name = "Post-Test")),
    pagination = FALSE,
    striped = TRUE,
    outlined = TRUE,
    compact = TRUE,
    highlight = TRUE,
    bordered = TRUE,
    searchable = TRUE,
    height = 600,
    width = 500)

hit_falo <- falo_hit %>% 
  select(client, hit_pre, hit_post) %>% 
  rename("Pre Score" = hit_pre,
         "Post Score" = hit_post) %>% 
   pivot_longer(
    cols = c(2:3),
    names_to = "measure",
    values_to = "score"
  )
```

```{r falo plots, include=FALSE}


hit_positions <- c("Pre Score", "Post Score")

p10 <- ggplot(hit_falo, aes(measure, score)) +
  geom_hline(yintercept = 50, 
             linetype = "dashed",
             size = 1) +
  geom_col(fill = "blue", 
           alpha = 0.7) +
  scale_x_discrete(limits = hit_positions) +
  scale_y_continuous(limits = c(0, 60),
                     breaks = c(10, 20, 30, 40, 50, 60)) + 
  geom_text(aes(measure, score, label = score),
            nudge_y = -3,
            color = "white") +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10)) +
  labs(x = "",
       y = "Score",
       title = "HIT Results",
       caption = "Scores of 50 or Greater Suggest Headaches Significantly Impact Daily Functioning") 

p10
```

```{r falo brief update, include=FALSE}
head(falo_brief_parent)
head(falo_brief_self)

falo_brief_self_tidy <- falo_brief_self %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

head(falo_brief_self_tidy)

brief_scales <- c("Global Executive Composite",
                  "Cognitive Regulation Index",
                  "Organization Scale",
                  "Task Completion Scale",
                  "Plan/Organize Scale",
                  "Working Memory Scale",
                  "Initiate Scale",
                  "Emotional Regulation Index",
                  "Emotional Control Scale",
                  "Shift Scale",
                  "Behavior Regulation Index",
                  "Self-Monitor Scale",
                  "Inhibit Scale")

falo_brief_self_tidy$Assessment <- factor(falo_brief_self_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

falo_brief_self_plot <- ggplot(falo_brief_self_tidy, aes(`Scale/Index`, `Response`)) +
  geom_line(aes(group = `Scale/Index`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = brief_scales) +
  scale_y_continuous(limits = c(30, 90),
                     breaks = c(30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90)) +
  geom_text_repel(aes(label = `Response`)) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "BRIEF-2 Self-Report",
    subtitle = "Scores Greater than 65 are Considered Clinically Significant")

falo_brief_self_plot


falo_brief_parent_tidy <- falo_brief_parent %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

falo_brief_parent_tidy$Assessment <- factor(falo_brief_parent_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

falo_brief_parent_plot <- ggplot(falo_brief_parent_tidy, aes(`Scale/Index`, `Response`)) +
  geom_line(aes(group = `Scale/Index`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = brief_scales) +
  scale_y_continuous(limits = c(30, 90),
                     breaks = c(30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90)) +
  geom_text_repel(aes(label = `Response`)) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "BRIEF-2 Parent-Report",
    subtitle = "Scores Greater than 65 are Considered Clinically Significant")

falo_brief_parent_plot
```

### BRIEF Client Responses
```{r falo brief, include=TRUE, fig.width=8}
falo_brief_self_plot
```

### BRIEF Parent Responses
```{r falo brief parent, include=TRUE, fig.width=8}
falo_brief_parent_plot
```

### CLASS 1
```{r falo class 1, include=TRUE, fig.width=8}
falo_class_worse_plot
```

### CLASS 2
```{r falo class 2, include=TRUE, fig.width=8}
falo_class_stress_plot
```


### PCSS

```{r falo pcss, include=TRUE}
falo_pcss_table
```

### HIT

```{r falo hit, include=TRUE}
p10
```

Column {data-width=350}
-----------------------------------------------------------------------

### Client Demographics

```{r, include=FALSE}
head(outcome)

demo_falo <- outcome %>% 
  filter(client == "FALO") %>% 
  select(2:5)
  
head(demo_falo)

falo_table <- demo_falo %>% 
  gt() %>% 
  cols_label(sex = "Sex",
             age = "Age",
             prev_mtbi = "Prior Concussions",
             hx_depression = "History of Depression or Anxiety") %>% 
  cols_align(align = "center", columns = vars(sex, age, prev_mtbi, hx_depression)) %>% 
  tab_header(title = "Client Demographics")
  
falo_table
```

```{r falo table, include=TRUE}
falo_table
```

# FALO Repeated 

Column {.tabset data-width=650}
-----------------------------------------------------------------------

### Status Tracking 1

```{r falo repeated measures data cleaning, include=FALSE}

head(falo_rm)

falo_status_1 <- falo_rm %>% 
  select(session, status_1)

falo_status_1_plot <- ggplot(falo_status_1, aes(session, status_1)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 7),
                     breaks = c(0, 1, 2, 3, 4, 5, 6, 7)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Number of Nights Per Week Gone to Bed Prior to 12:00 AM",
       title = "Status Tracking Goal 1") 

falo_status_1_plot

phone_falo <- falo_rm %>% 
  select(session, num_nights)

phone_falo_graph <- ggplot(phone_falo, aes(session, num_nights)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 7),
                     breaks = c(0, 1, 2, 3, 4, 5, 6, 7)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Number of Nights Per Week Implementing No-Phone Strategy",
       title = "No Phone Strategy",
       subtitle = "To be implemented 1:00-7:00 AM") 

phone_falo_graph

falo_effect <- falo_rm %>% 
  select(session, effect)

falo_effect_graph <- ggplot(falo_effect, aes(session, effect)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 5),
                     breaks = c(1, 2, 3, 4, 5)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Perceived Effectiveness",
       title = "Perceived Effectiveness of No Phone Strategy",
       caption = "1 = Not Effective at All\n 2 = Not Effective\n 3 = Somewhat Effective\n 4 = Effective\n 5 = Very Effective") 

falo_effect_graph

falo_status_2 <- falo_rm %>% 
  select(session, status_2)

falo_status_2_plot <- ggplot(falo_status_2, aes(session, status_2)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 5),
                     breaks = c(0 , 1, 2, 3, 4, 5)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Number of Missing Assignments per Week",
       title = "Status Tracking Goal 2") 

falo_status_2_plot

head(falo_rm)

falo_freq_1 <- falo_rm %>% 
  select(session, planner)

falo_freq_1_plot <- ggplot(falo_freq_1, aes(session, planner)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 10),
                     breaks = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Number of Weekly Assignments Entered into Calendar",
       title = "Frequency of Planner Use") 

falo_freq_1_plot

falo_help_1 <- falo_rm %>% 
  select(session, help_plan)

falo_planner_plot <- ggplot(falo_help_1, aes(session, help_plan)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 5),
                     breaks = c(1, 2, 3, 4, 5)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Perceived Helpfulness",
       title = "Perceived Helpfulness of Tracking Assignments in Planner",
       caption = "1 = Not Helpful at All\n 2 = Not Helpful\n 3 = Somewhat Helpful\n 4 = Helpful\n 5 = Very Helpful") 

falo_planner_plot


falo_freq_2 <- falo_rm %>% 
  select(session, num_days)

falo_freq_2_plot <- ggplot(falo_freq_2, aes(session, num_days)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 7),
                     breaks = c(0, 1, 2, 3, 4, 5, 6, 7)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Number of Days Per Week Using Time Block Strategy",
       title = "Frequency of Time Block Strategy Use") 

falo_freq_2_plot

falo_help_2 <- falo_rm %>% 
  select(session, help_block)

falo_block_plot <- ggplot(falo_help_2, aes(session, help_block)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 5),
                     breaks = c(1, 2, 3, 4, 5)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Perceived Helpfulness",
       title = "Perceived Helpfulness of Time Block Strategy",
       caption = "1 = Not Helpful at All\n 2 = Not Helpful\n 3 = Somewhat Helpful\n 4 = Helpful\n 5 = Very Helpful") 

falo_block_plot
```


```{r falo status 1, include=TRUE}
falo_status_1_plot
```

### Phone Strategy Use

```{r falo phone graph, include=TRUE, fig.align="left"}
phone_falo_graph
```

### Perceived Effectiveness 

```{r phone strategy helpfulness, include=TRUE, fig.align="left"}
falo_effect_graph
```

### Status Tracking 2

```{r falo status tracking 2, include=TRUE}
falo_status_2_plot
```

### Planner Use
```{r falo planner use, include=TRUE}
falo_freq_1_plot
```

### Planner Helpfulness
```{r falo planner helpfulness, include=TRUE}
falo_planner_plot
```

### Time Block Use
```{r falo time block use, include=TRUE}
falo_freq_2_plot
```

### Planner Helpfulness
```{r falo time block helpfulness, include=TRUE}
falo_block_plot
```


# DRKAT Outcome 

Column {.tabset data-width=650}
-----------------------------------------------------------------------

```{r drkat measures data organization, include=FALSE}
head(outcome)

drkat_hit <- outcome %>% 
  filter(client == "DRKAT")

head(drkat_class_worse)
head(drkat_class_stress)

drkat_class_worse_tidy <- drkat_class_worse %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

class_1 <- c("Easily bothered by lights/screens or noise",
             "Tiring easily during homework",
             "Tiring easily during the school day",
             "Headaches interfering with homework",
             "Headaches interfering with classwork",
             "Easily distracted during homework",
             "Easily distracted during classwork",
             "Trouble reading",
             "Trouble remembering what was studied",
             "Difficulty studying for tests or quizzes",
             "Homework taking longer",
             "In class, work taking longer",
             "Difficulty understanding new material",
             "Difficulty taking notes")

class_1_resp <- c("A lot worse",
                  "Somewhat worse",
                  "A little worse",
                  "Not worse")

drkat_class_worse_tidy$Assessment <- factor(drkat_class_worse_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

drkat_class_worse_plot <- ggplot(drkat_class_worse_tidy, aes(`Question`, `Response`)) +
  geom_line(aes(group = `Question`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = class_1) +
  scale_y_discrete(limits = class_1_resp) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10, angle = 90),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "CLASS Responses",
       subtitle = "Questions 1-14")

drkat_class_worse_plot

head(drkat_class_stress)

drkat_class_stress_tidy <- drkat_class_stress %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

class_2 <- c("Stressed out about your grades dropping",
             "More stressed out/overwhelmed with the schoolwork piling up",
             "Not having enough support at home from parents/siblings",
             "Not having enough support from teachers",
             "Not being allowed to play sports/recreation",
             "Missing time with friends and/or social activities")

class_2_resp <- c("Very stressful",
                  "Moderately stressful",
                  "A little stressful",
                  "Not stressful")

drkat_class_stress_tidy$Assessment <- factor(drkat_class_stress_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

drkat_class_stress_plot <- ggplot(drkat_class_stress_tidy, aes(`Question`, `Response`)) +
  geom_line(aes(group = `Question`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = class_2) +
  scale_y_discrete(limits = class_2_resp) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10, angle = 90),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "CLASS Responses",
       subtitle = "Questions 15-20")

drkat_class_stress_plot

head(drkat_pcss)
drkat_pcss_table <- falo_pcss %>% 
  reactable(
    columns = list(
      `Pre Test` = colDef(name = "Pre-Test"),
      `Post Test` = colDef(name = "Post-Test")),
    pagination = FALSE,
    striped = TRUE,
    outlined = TRUE,
    compact = TRUE,
    highlight = TRUE,
    bordered = TRUE,
    searchable = TRUE,
    height = 600,
    width = 500)

hit_drkat <- drkat_hit %>% 
  select(client, hit_pre, hit_post) %>% 
  rename("Pre Score" = hit_pre,
         "Post Score" = hit_post) %>% 
   pivot_longer(
    cols = c(2:3),
    names_to = "measure",
    values_to = "score"
  )
```

```{r drkat plots, include=FALSE}

drkat_hit_plot <- ggplot(hit_drkat, aes(measure, score)) +
  geom_hline(yintercept = 50, 
             linetype = "dashed",
             size = 1) +
  geom_col(fill = "blue", 
           alpha = 0.7) +
  scale_x_discrete(limits = hit_positions) +
  scale_y_continuous(limits = c(0, 60),
                     breaks = c(10, 20, 30, 40, 50, 60)) + 
  geom_text(aes(measure, score, label = score),
            nudge_y = -3,
            color = "white") +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10)) +
  labs(x = "",
       y = "Score",
       title = "HIT Results",
       caption = "Scores of 50 or Greater Suggest Headaches Significantly Impact Daily Functioning") 

drkat_hit_plot
```

```{r drkat brief update, include=FALSE}
head(drkat_brief_self)

drkat_brief_self_tidy <- drkat_brief_self %>% 
  pivot_longer(
    cols = c(`Pre-Test`, `Post-Test`),
    names_to = "Assessment",
    values_to = "Response"
  )

head(drkat_brief_self_tidy)

brief_scales <- c("Global Executive Composite",
                  "Cognitive Regulation Index",
                  "Organization Scale",
                  "Task Completion Scale",
                  "Plan/Organize Scale",
                  "Working Memory Scale",
                  "Initiate Scale",
                  "Emotional Regulation Index",
                  "Emotional Control Scale",
                  "Shift Scale",
                  "Behavior Regulation Index",
                  "Self-Monitor Scale",
                  "Inhibit Scale")

drkat_brief_self_tidy$Assessment <- factor(drkat_brief_self_tidy$Assessment, levels = c("Pre-Test", "Post-Test"))

drkat_brief_self_plot <- ggplot(drkat_brief_self_tidy, aes(`Scale/Index`, `Response`)) +
  geom_line(aes(group = `Scale/Index`), color = "gray40") +
  geom_point(aes(color = `Assessment`)) +
  coord_flip() +
  scale_x_discrete(limits = brief_scales) +
  scale_y_continuous(limits = c(30, 90),
                     breaks = c(30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90)) +
  geom_text_repel(aes(label = `Response`)) +
  theme(panel.grid.major.y = element_blank(),
        panel.grid.minor.x = element_blank(),
        panel.grid.major.x = element_line(color = "gray80")) +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        plot.subtitle = element_text(color = "black", size = 10, face = "bold"),
        axis.text.x = element_text(size = 10),
        axis.text.y = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10),
        plot.caption = element_text(size = 10),
        legend.title = element_text(size = 12),
        legend.text = element_text(size = 10),
        legend.position = "bottom") +
  labs(x = "",
       y = "",
    title = "BRIEF-A Self-Report",
    subtitle = "Scores Greater than 65 are Considered Clinically Significant")

drkat_brief_self_plot

```

### BRIEF 
```{r drkat brief, include=TRUE, fig.width=8}
drkat_brief_self_plot
```

### CLASS 1 

#### CLASS post-treatment scores not included as the client was not actively enrolled in school for the majority of the duration of treatment. 
```{r drkat class 1, include=TRUE, fig.width=8}
drkat_class_worse_plot
```

### CLASS 2 

#### CLASS post-treatment scores not included as the client was not actively enrolled in school for the majority of the duration of treatment. 
```{r drkat class 2, include=TRUE, fig.width=8}
drkat_class_stress_plot
```


### PCSS

```{r drkat pcss, include=TRUE}
falo_pcss_table
```


### HIT

```{r drkat hit, include=TRUE}
drkat_hit_plot
```

Column {data-width=350}
-----------------------------------------------------------------------

### Client Demographics

```{r, include=FALSE}
head(outcome)

demo_drkat <- outcome %>% 
  filter(client == "DRKAT") %>% 
  select(2:5)
  
head(demo_drkat)

drkat_table <- demo_drkat %>% 
  gt() %>% 
  cols_label(sex = "Sex",
             age = "Age",
             prev_mtbi = "Prior Concussions",
             hx_depression = "History of Depression or Anxiety") %>% 
  cols_align(align = "center", columns = vars(sex, age, prev_mtbi, hx_depression)) %>% 
  tab_header(title = "Client Demographics")
  
drkat_table
```

```{r drkat table, include=TRUE}
drkat_table
```


# DRKAT Repeated

Column {.tabset data-width=650}
-----------------------------------------------------------------------

### Status Tracking

```{r repeated measures drkat data cleaning, include=FALSE}
head(rm_drkat)

drkat_track <- rm_drkat %>% 
  select(session, status)

drkat_status_plot <- ggplot(drkat_track, aes(session, status)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Number of House Chores Completed per Week",
       title = "Status Tracking Goal") 

drkat_status_plot

drkat_effort <- rm_drkat %>% 
  select(session, effort)

drkat_effort_plot <- ggplot(drkat_effort, aes(session, effort)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Perceived Effort",
       title = "Perceived Effort While Completing House Chores",
       caption = "1 = No Effort\n 2 = A little Effort\n 3 = Somewhat Effortful\n 4 = Quite Effortful\n 5 = Extremely Effortful")  

drkat_motivation <- rm_drkat %>% 
  select(session, motivation)

drkat_motivation_plot <- ggplot(drkat_motivation, aes(session, motivation)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Perceived Motivation",
       title = "Perceived Motivation to Complete House Chores",
       caption = "1 = No Motivation\n 2 = A little Motivation\n 3 = Somewhat Motivated\n 4 = Quite Motivated\n 5 = Extremely Motivated")  

drkat_freq <- rm_drkat %>% 
  select(session, frequency)

drkat_freq_plot <- ggplot(drkat_freq, aes(session, frequency)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 10),
                     breaks = c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Number of Tasks Entered into Calendar per Week",
       title = "Frequency of Calendar Use") 


drkat_help <- rm_drkat %>% 
  select(session, helpfulness)

drkat_help_plot <- ggplot(drkat_help, aes(session, helpfulness)) +
  geom_line() +
  geom_point(size = 2) +
  scale_x_continuous(limits = c(0, 10),
                     breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)) +
  scale_y_continuous(limits = c(0, 5),
                     breaks = c(1, 2, 3, 4, 5)) +
  theme_classic() +
  theme(plot.title = element_text(color = "black", size = 12, face = "bold", hjust = 0.5),
        axis.text = element_text(size = 10),
        axis.title=element_text(size=10),
        strip.text = element_text(size = 10)) +
  labs(x = "Session",
       y = "Perceived Helpfulness",
       title = "Perceived Helpfulness of Calendar",
       caption = "1 = Not Helpful at All\n 2 = Not Helpful\n 3 = Somewhat Helpful\n 4 = Helpful\n 5 = Very Helpful") 
```


```{r drkat status, include=TRUE}
drkat_status_plot
```

### Perceived Effort
```{r drkat perceived effort, include=TRUE}
drkat_effort_plot
```

### Perceived Motivation 
```{r drkat perceived motivation, include=TRUE}
drkat_motivation_plot
```

### Planner Use
```{r drkat perceived frequency of strategy use, include=TRUE}
drkat_freq_plot
```

### Perceived Helpfulness
```{r drkat perceived helpfulness of strategy use, include=TRUE}
drkat_help_plot
```